<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <style>
    .flip {
      position: relative;
      perspective: 1000;
    }
    .flip .A,.flip .B {
      border: 2px solid black;
      line-height: 100px;
      font-size: 30px;
      color: white;
      text-align: center;
      position: absolute;
      backface-visibility: hidden;
    }
    .flip .flip-container,.flip .A,.flip .B{
      width: 150px;
      height: 100px;
    }

    .flip .flip-container {
      position: relative;
      transition-duration: 0.5s;
      transition-timing-function: ease-in;
      transform-style: preserve-3d;
    }
    .A {
      background-color: red;
      transform: rotateY(0deg);
    }
    .B {
      background-color: blue;
      transform: rotateY(180deg);
    }
    .flip .flip-container.loaded {
      transform: rotateY(540deg);
    }



  </style>
  <div class='flip'>
    <div class='flip-container'>
      <div class='A'>A</div>
      <div class='B'>B</div>
    </div>
  </div>
</body>
</html>